import request from '@/utils/request'

/**
 * 洗车单子详情-非编辑
 * @param {*} id 
 */
export function getWashById(id) {
  return request.get(`/wash/detail/${id}`)
}

/**
 * 洗车单新增
 * @param {*} param 
 */
export function addWash(param) {
  return request.post('/wash/save', param)
}

/**
 * 洗车单编辑
 * @param {*} param 
 */
export function editWash(param) {
  return request.put('/wash/save', param)
}

/**
 * 删除
 * @param {*} id 
 */
export function deleteWash(id) {
  return request.delete(`/wash/del/${id}`)
}

/**
 * 洗车单子分页
 * @param {*} param 
 * @param {*} pageSize 
 * @param {*} pageNo 
 */
export function washList(param, pageSize, pageNo) {
  const data = {
    pageNo,
    pageSize,
    param: {
      ...param
    }
  }
  return request.post('/wash/page', data)
}
/**
 * 洗车单项目分页
 * @param {*} param 
 * @param {*} pageSize 
 * @param {*} pageNo 
 */
export function washProjectPage(param, pageSize, pageNo) {
  const data = {
    pageNo,
    pageSize,
    param: {
      ...param
    }
  }
  return request.post('/washProject/page', data)
}

/**
 * 洗车单返工确认
 * @param {*} param 
 */
export function washProjectReworkSave(param) {
  return request.put('/washProjectRework/rework', param)
}

/**
 * 编辑详情
 * @param {*} id 
 * @param {*} param 
 */
export function editWashDetail(id, param) {
  return request.get(`/wash/findById/${id}`, param)
}

//工单预付款
export function washImprest(param) {
  return request.put(`/wash/imprest`, param)
}

//工单增项
export function washInsProject(param) {
  return request.put(`/wash/insProject`, param)
}

//获取客户信息
export function getClientById(id) {
  return request.get(`/wash/client/${id}`)
}

//工单派工
export function washDispatch(id) {
  return request.get(`/wash/client/${id}`)
}

//生成洗车单工单编号
export function washGetWorkOrderCode() {
  return request.get(`/wash/getWorkOrderCode`)
}

/**
 * 洗车单派工
 * @param {*} id 
 */
export function washDispatchID(id) {
  return request.get(`/wash/dispatch/${id}`)
}
/**
 * 洗车单返工分页
 * @param {*} param 
 * @param {*} pageSize 
 * @param {*} pageNo 
 */
export function washProjectReworkPage(param, pageSize, pageNo) {
  const data = {
    pageNo,
    pageSize,
    param: {
      ...param
    }
  }
  return request.post('/washProjectRework/page', data)
}
